all: tcpserv01 tcpcli01 selectsrv02 selectcli02 pollsrv03

CC = gcc

INCLUDE = .

ifneq ($(DEBUG), true)
  CFLAGS = -Wall
else
  CFLAGS = -g -Wall
endif

.cpp.o:
	$(CC) $(CFLAGS) -I$(INCLUDE) -c $<

LIB = error.o util.o
tcpserv01: tcpserv01.o $(LIB)
	$(CC) $(CFLAGS) -I$(INCLUDE) -o tcpserv01 tcpserv01.o $(LIB)

tcpcli01: tcpcli01.o $(LIB)
	$(CC) $(CFLAGS) -I$(INCLUDE) -o tcpcli01 tcpcli01.o $(LIB)

selectsrv02: selectsrv02.o $(LIB)
	$(CC) $(CFLAGS) -I$(INCLUDE) -o selectsrv02 selectsrv02.o $(LIB)

selectcli02: selectcli02.o $(LIB)
	$(CC) $(CFLAGS) -I$(INCLUDE) -o selectcli02 selectcli02.o $(LIB)

pollsrv03: pollsrv03.o $(LIB)
	$(CC) $(CFLAGS) -I$(INCLUDE) -o pollsrv03 pollsrv03.o $(LIB)

clean:
	rm -f *.o
